package com.example.exp03_calculatebmi.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.exp03_calculatebmi.R;
import com.example.exp03_calculatebmi.data.Adult;

public class SecondActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView showResult;
    private Intent intent = new Intent();;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        showResult = findViewById(R.id.resultshow);
        findViewById(R.id.returnButton).setOnClickListener(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        intent = getIntent();
        Adult adult = (Adult) intent.getSerializableExtra("info");
        showResult.setText(adult.judge());
    }

    @Override
    public void onClick(View view) {
        //        显式Intent
        intent.setClass(SecondActivity.this,FirstActivity.class );
        startActivity(intent);
    }
}